<%@page language="java" pageEncoding="UTF-8"%>
<%@include file="header.jsp"%>
<body>
	<!--load custom components-->
	<script type="text/javascript" src="js/extjs/ux/GroupSummary.js"></script>
	<script type="text/javascript" src="js/app/util/calculator.js"></script>
	<script type="text/javascript" src="js/app/header.js"></script>
	<script type="text/javascript" src="js/app/tabs/generalTab.js"></script>
	<script type="text/javascript" src="js/app/tabs/rentTab.js"></script>
	<script type="text/javascript" src="js/app/tabs/electricityTab.js"></script>
	<script type="text/javascript" src="js/app/tabs/waterTab.js"></script>
	<script type="text/javascript" src="js/app/tabs/gasTab.js"></script>
	<script type="text/javascript" src="js/app/tabs/heatingTab.js"></script>
	<script type="text/javascript" src="js/app/tabs/phoneTab.js"></script>
	<script type="text/javascript" src="js/app/tabs/intercomTab.js"></script>
	<script type="text/javascript" src="js/app/tabs/tvTab.js"></script>
	<script type="text/javascript" src="js/app/tabs/netTab.js"></script>
	<script type="text/javascript" src="js/app/main.js"></script>
	<script type="text/javascript">
		
		/*data types */
		var INTEGER = "<%=AbstractController.TYPE_INTEGER%>";
		var STRING = "<%=AbstractController.TYPE_STRING%>";
		var FLOAT = "<%=AbstractController.TYPE_FLOAT%>";
		var DATE = "<%=AbstractController.TYPE_DATE%>";

		/*date format for show date data */
		var DATE_FORMAT = "<%=AppConstants.DATE_FORMAT%>";

		//number of displayed record on one page
		var PAGE_RECORD_COUNT = <%=AppConstants.PAGE_RECORD_COUNT%>;

		var FAKE_ID = <%=AppConstants.FAKE_ID%>;
		var ENTITY_STATE_ENABLED = <%=AppConstants.ENTITY_STATE_ENABLED%>;
		var ENTITY_STATE_DISABLED = <%=AppConstants.ENTITY_STATE_DISABLED%>;

		var COLOR_HEX_RED = "<%=AppConstants.COLOR_HEX_RED%>";
		var COLOR_HEX_BLUE = "<%=AppConstants.COLOR_HEX_BLUE%>";	
		
		var months = [[0, '<fmt:message key="month.january"/>'],
		              [1, '<fmt:message key="month.febuary"/>'],
		              [2, '<fmt:message key="month.march"/>'],
		              [3, '<fmt:message key="month.april"/>'],
		              [4, '<fmt:message key="month.may"/>'],
		              [5, '<fmt:message key="month.june"/>'],
		              [6, '<fmt:message key="month.july"/>'],
		              [7, '<fmt:message key="month.august"/>'],
		              [8, '<fmt:message key="month.september"/>'],
		              [9, '<fmt:message key="month.october"/>'],
		              [10,'<fmt:message key="month.november"/>'],
		              [11,'<fmt:message key="month.december"/>']];

		var WATER_TARIF_COUNTER = <%=AppConstants.WATER_TARIF_COUNTER%>;
		var WATER_TARIF_FIXED = <%=AppConstants.WATER_TARIF_FIXED%>;
        var waterTarifTypes = [
        	[WATER_TARIF_COUNTER, '<fmt:message key="label.water.tarif.counter"/>'], 
        	[WATER_TARIF_FIXED, '<fmt:message key="label.water.tarif.fixed"/>']
        ];

		var INTERNET_TARIF_LIMIT = <%=AppConstants.INTERNET_TARIF_LIMIT%>;
		var INTERNET_TARIF_UNLIMIT = <%=AppConstants.INTERNET_TARIF_UNLIMIT%>;
		var internetTarifTypes = [
			[INTERNET_TARIF_LIMIT, '<fmt:message key="label.internet.tarif.limit"/>'], 
			[INTERNET_TARIF_UNLIMIT, '<fmt:message key="label.internet.tarif.unlimit"/>']
     	];
		
		/*general keys for json data */
		var ROOT = "<%=AbstractController.KEY_DATA%>";
		var TOTAL_PROPERTY = "<%=AbstractController.KEY_TOTAL%>";
		var ID_PROPERTY = "<%=AbstractController.KEY_ID%>";	
		var SUCCSESS_PROPERTY = "<%=AbstractController.KEY_SUCCESS%>"; 
		var MESSAGE_PROPERTY = "<%=AbstractController.KEY_MESSAGE%>";

		var indexes = new Array();
		var labels = new Array(); 
		var messages = new Array();
		var qtips = new Array();
		
		/*common keys for entities */
		indexes['id'] = "<%=BaseForm.ID%>";
		indexes['enabled'] = "<%=BaseForm.ENABLED%>";
		indexes['modelId'] = "<%=BaseForm.MODEL_ID%>";

		/*common keys for communal records properties*/
		indexes['summa'] = "<%=CRForm.SUMMA%>";
		indexes['date'] = "<%=CRForm.DATE%>";
		indexes['month'] = "<%=CRForm.MONTH%>";
		indexes['year'] = "<%=CRForm.YEAR%>";
			
		labels['login.textfield.label'] = '<fmt:message key="login.textfield.label"/>';
		labels['password.textfield.label'] = '<fmt:message key="password.textfield.label"/>';
		labels['firstname.textfield.label'] = '<fmt:message key="firstname.textfield.label"/>';
		labels['lastname.textfield.label'] = '<fmt:message key="lastname.textfield.label"/>';
		labels['rememberme.checkbox.label'] = '<fmt:message key="rememberme.checkbox.label"/>';
		labels['clear.button.label'] = '<fmt:message key="clear.button.label"/>';
		labels['close.button.label'] = '<fmt:message key="close.button.label"/>';
		labels['failure.alert.title'] = '<fmt:message key="failure.alert.title"/>';
		labels['attention.alert.title'] = '<fmt:message key="attention.alert.title"/>';

		/*general button titles*/
		labels['button.title.add'] = '<fmt:message key="button.title.add"/>';
		labels['button.title.remove'] = '<fmt:message key="button.title.remove"/>';
		labels['button.title.save'] = '<fmt:message key="button.title.save"/>';
		labels['button.title.cancel'] = '<fmt:message key="button.title.cancel"/>';

		/*app and tab titles*/
		labels['application.title'] = '<fmt:message key="application.title"/>';
		labels['button.title.about'] = '<fmt:message key="button.title.about"/>';
		labels['header.title.theme'] = '<fmt:message key="header.title.theme"/>';
		labels['grid.pagination.display.message'] = '<fmt:message key="grid.pagination.display.message"/>';
		labels['grid.pagination.empty.message'] = '<fmt:message key="grid.pagination.empty.message"/>';
		labels['datefield.statistic.startdate'] = '<fmt:message key="datefield.statistic.startdate"/>';
		labels['datefield.statistic.enddate'] = '<fmt:message key="datefield.statistic.enddate"/>';
		labels['chart.statisticbydate.yaxis.displayname'] = '<fmt:message key="chart.statisticbydate.yaxis.displayname"/>';
		labels['button.logout.label'] = '<fmt:message key="button.logout.label"/>';
		labels['edit.profile.title'] = '<fmt:message key="edit.profile.title"/>';
		labels['datefield.min.label'] = '<fmt:message key="datefield.min.label"/>';
		labels['datefield.max.label'] = '<fmt:message key="datefield.max.label"/>';
		labels['summafield.min.label'] = '<fmt:message key="summafield.min.label"/>';
		labels['summafield.max.label'] = '<fmt:message key="summafield.max.label"/>';
		labels['calculator.title'] = '<fmt:message key="calculator.title"/>';
		labels['datefield.date.error'] = '<fmt:message key="datefield.date.error"/>';
		labels['datefield.min.value'] = '<fmt:message key="datefield.min.value"/>';		
		labels['default.theme.url'] = '<fmt:message key="default.theme.url"/>';

		//column titles
		labels['column.title.delete'] = '<fmt:message key="column.title.delete"/>';
		
		/*general labels for communal payments*/
		
		labels['label.tarif']='<fmt:message key="label.tarif"/>';
		labels['label.tarif.name']='<fmt:message key="label.tarif.name"/>';
		labels['label.tarif.type']='<fmt:message key="label.tarif.type"/>';
		labels['label.summa']='<fmt:message key="label.summa"/>';
		labels['label.date']='<fmt:message key="label.date"/>';
		labels['label.month']='<fmt:message key="label.month"/>';
		labels['label.year']='<fmt:message key="label.year"/>';
		labels['button.title.showall']='<fmt:message key="button.title.showall"/>';
		labels['label.window.title']='<fmt:message key="label.window.title"/>';
		labels['label.tariff.grid.title']='<fmt:message key="label.tariff.grid.title"/>';
		labels['label.chart.title']='<fmt:message key="label.chart.title"/>';
		labels['label.value.positive']='<fmt:message key="label.value.positive"/>';
		labels['label.value.over']='<fmt:message key="label.value.over"/>';
		labels['label.value.empty']='<fmt:message key="label.value.empty"/>';

		/*general tab labels*/
		labels['label.general.tab.title']='<fmt:message key="label.general.tab.title"/>';
		labels['label.column.rent']='<fmt:message key="label.column.rent"/>';
		labels['label.column.electricity']='<fmt:message key="label.column.electricity"/>';
		labels['label.column.coldwater']='<fmt:message key="label.column.coldwater"/>';
		labels['label.column.hotwater']='<fmt:message key="label.column.hotwater"/>';
		labels['label.column.gas']='<fmt:message key="label.column.gas"/>';
		labels['label.column.heating']='<fmt:message key="label.column.heating"/>';
		labels['label.column.phone']='<fmt:message key="label.column.phone"/>';
		labels['label.column.intercom']='<fmt:message key="label.column.intercom"/>';
		labels['label.column.internet']='<fmt:message key="label.column.internet"/>';
		labels['label.column.tv']='<fmt:message key="label.column.tv"/>';
		labels['label.column.total']='<fmt:message key="label.column.total"/>';

		/*rent tab labels*/
		labels['label.rent.grid.title']='<fmt:message key="label.rent.grid.title"/>';
		labels['label.rent.tab.title']='<fmt:message key="label.rent.tab.title"/>';
		labels['label.rent.tariff.area']='<fmt:message key="label.rent.tariff.area"/>';
		labels['label.rent.tariff.peopleamount']='<fmt:message key="label.rent.tariff.peopleamount"/>';
		
		/*electricity tab labels*/
		labels['label.tarif.under']='<fmt:message key="label.tarif.under"/>';
		labels['label.tarif.over']='<fmt:message key="label.tarif.over"/>';
		labels['label.tarif.energy.amount']='<fmt:message key="label.tarif.energy.amount"/>';
		labels['label.tarif.energy.amount.column.header']='<fmt:message key="label.tarif.energy.amount.column.header"/>';
		labels['label.electricity.current.value']='<fmt:message key="label.electricity.current.value"/>';
		labels['label.electricity.previous.value']='<fmt:message key="label.electricity.previous.value"/>';
		labels['label.electricity.grid.title']='<fmt:message key="label.electricity.grid.title"/>';
		labels['label.electricity.tab.title']='<fmt:message key="label.electricity.tab.title"/>';

		/*intercom tab labels*/
		labels['label.intercom.grid.title']='<fmt:message key="label.intercom.grid.title"/>';
		labels['label.intercom.tab.title']='<fmt:message key="label.intercom.tab.title"/>';

		/*heating tab labels*/
		labels['label.heating.grid.title']='<fmt:message key="label.heating.grid.title"/>';
		labels['label.heating.tab.title']='<fmt:message key="label.heating.tab.title"/>';
		labels['label.heating.tariff.area']='<fmt:message key="label.heating.tariff.area"/>';
		labels['label.heating.tariff.onem2']='<fmt:message key="label.heating.tariff.onem2"/>';

		/*water tab labels*/
		labels['label.water.delta.chart.title']='<fmt:message key="label.water.delta.chart.title"/>';
		labels['label.tarif.cold.grid.title']='<fmt:message key="label.tarif.cold.grid.title"/>';
		labels['label.tarif.hot.grid.title']='<fmt:message key="label.tarif.hot.grid.title"/>';
		labels['label.water.grid.title']='<fmt:message key="label.water.grid.title"/>';
		labels['label.water.tab.title']='<fmt:message key="label.water.tab.title"/>';
		labels['label.water.tarif.cold']='<fmt:message key="label.water.tarif.cold"/>';
		labels['label.water.tarif.hot']='<fmt:message key="label.water.tarif.hot"/>';
		labels['label.water.counter.cold.current']='<fmt:message key="label.water.counter.cold.current"/>';
		labels['label.water.counter.cold.previous']='<fmt:message key="label.water.counter.cold.previous"/>';
		labels['label.water.delta.cold']='<fmt:message key="label.water.delta.cold"/>';
		labels['label.water.summa.cold']='<fmt:message key="label.water.summa.cold"/>';
		labels['label.water.counter.hot.current']='<fmt:message key="label.water.counter.hot.current"/>';
		labels['label.water.counter.hot.previous']='<fmt:message key="label.water.counter.hot.previous"/>';
		labels['label.water.delta.hot']='<fmt:message key="label.water.delta.hot"/>';
		labels['label.water.summa.hot']='<fmt:message key="label.water.summa.hot"/>';
		labels['label.column.water.counter.cold.current']='<fmt:message key="label.column.water.counter.cold.current"/>';
		labels['label.column.water.counter.cold.previous']='<fmt:message key="label.column.water.counter.cold.previous"/>';
		labels['label.column.water.delta.cold']='<fmt:message key="label.column.water.delta.cold"/>';
		labels['label.column.water.summa.cold']='<fmt:message key="label.column.water.summa.cold"/>';
		labels['label.column.water.counter.hot.current']='<fmt:message key="label.column.water.counter.hot.current"/>';
		labels['label.column.water.counter.hot.previous']='<fmt:message key="label.column.water.counter.hot.previous"/>';
		labels['label.column.water.delta.hot']='<fmt:message key="label.column.water.delta.hot"/>';
		labels['label.column.water.summa.hot']='<fmt:message key="label.column.water.summa.hot"/>';		

		/*internet tab labels*/
		labels['label.internet.undersumma']='<fmt:message key="label.internet.undersumma"/>';	
		labels['label.internet.oversumma']='<fmt:message key="label.internet.oversumma"/>';	
		labels['label.internet.bordervalue']='<fmt:message key="label.internet.bordervalue"/>';	
		labels['label.internet.unlimit.summa']='<fmt:message key="label.internet.unlimit.summa"/>';	
		labels['label.internet.currentvalue']='<fmt:message key="label.internet.currentvalue"/>';	
		labels['label.internet.advanced.summa']='<fmt:message key="label.internet.advanced.summa"/>';	
		labels['label.column.internet.undersumma']='<fmt:message key="label.column.internet.undersumma"/>';	
		labels['label.column.internet.oversumma']='<fmt:message key="label.column.internet.oversumma"/>';	
		labels['label.column.internet.bordervalue']='<fmt:message key="label.column.internet.bordervalue"/>';	
		labels['label.column.internet.unlimit.summa']='<fmt:message key="label.column.internet.unlimit.summa"/>';	
		labels['label.column.internet.currentvalue']='<fmt:message key="label.column.internet.currentvalue"/>';	
		labels['label.column.internet.advanced.summa']='<fmt:message key="label.column.internet.advanced.summa"/>';	
		labels['label.internet.grid.title']='<fmt:message key="label.internet.grid.title"/>';	
		labels['label.internet.tab.title']='<fmt:message key="label.internet.tab.title"/>';		

		
		/*general error messages*/
		messages['message.error.connect.failure'] = '<fmt:message key="message.error.connect.failure"/>';
		messages['message.error.server.invalid'] = '<fmt:message key="message.error.server.invalid"/>';
		
		messages['login.textfield.empty.message'] = '<fmt:message key="login.textfield.empty.message"/>';
		messages['login.textfield.invalid.message'] = '<fmt:message key="login.textfield.invalid.message"/>';
		messages['password.textfield.empty.message'] = '<fmt:message key="password.textfield.empty.message"/>';
		messages['password.textfield.invalid.message'] = '<fmt:message key="password.textfield.invalid.message"/>';		
		messages['firstname.textfield.empty.message'] = '<fmt:message key="firstname.textfield.empty.message"/>';
		messages['firstname.textfield.invalid.message'] = '<fmt:message key="firstname.textfield.invalid.message"/>';
		messages['lastname.textfield.empty.message'] = '<fmt:message key="lastname.textfield.empty.message"/>';
		messages['lastname.textfield.invalid.message'] = '<fmt:message key="lastname.textfield.invalid.message"/>';
		messages['alert.message.deleterecord'] =	'<fmt:message key="alert.message.deleterecord"/>';							 											 
		messages['logout.confirm.message'] = '<fmt:message key="logout.confirm.message"/>';
		messages['edit.profile.failure.alert.message'] = '<fmt:message key="edit.profile.failure.alert.message"/>';

		/*general messages for communal payments*/
		
		/*electricity messages*/
		messages['message.tarif.under.greater.over'] = '<fmt:message key="message.tarif.under.greater.over"/>';
		messages['message.electricity.prev.greater.current'] = '<fmt:message key="message.electricity.prev.greater.current"/>';
		
		/*heating messages*/
		messages['message.tariff.summa.change'] = '<fmt:message key="message.tariff.summa.change"/>';
		
		/*qtips for buttons and column headers*/
		qtips['qtips.button.login'] = '<fmt:message key="qtips.button.login"/>';
		qtips['qtips.button.clear'] = '<fmt:message key="qtips.button.clear"/>';
		qtips['qtips.button.calculator'] = '<fmt:message key="qtips.button.calculator"/>';
		qtips['qtips.button.profile.open'] = '<fmt:message key="qtips.button.profile.open"/>';
		qtips['qtips.button.profile.save'] = '<fmt:message key="qtips.button.profile.save"/>';
		qtips['qtips.button.about.application'] = '<fmt:message key="qtips.button.about.application"/>';
		qtips['qtips.button.logout'] = '<fmt:message key="qtips.button.logout"/>';

		/*general qtips for communal payments*/
		qtips['qtips.tarif.save'] = '<fmt:message key="qtips.tarif.save"/>';
		qtips['qtips.column.tarif.name'] = '<fmt:message key="qtips.column.tarif.name"/>';
		qtips['qtips.column.tarif.type'] = '<fmt:message key="qtips.column.tarif.type"/>';
		qtips['qtips.button.tarif.add'] = '<fmt:message key="qtips.button.tarif.add"/>';
		qtips['qtips.column.year'] = '<fmt:message key="qtips.column.year"/>';
		qtips['qtips.column.month'] = '<fmt:message key="qtips.column.month"/>';
		qtips['qtips.column.delete'] = '<fmt:message key="qtips.column.delete"/>';
		qtips['qtips.button.showall'] = '<fmt:message key="qtips.button.showall"/>';

		/*general tab qtips*/
		qtips['qtips.column.rent'] = '<fmt:message key="qtips.column.rent"/>';
		qtips['qtips.column.electricity'] = '<fmt:message key="qtips.column.electricity"/>';
		qtips['qtips.column.coldwater'] = '<fmt:message key="qtips.column.coldwater"/>';
		qtips['qtips.column.hotwater'] = '<fmt:message key="qtips.column.hotwater"/>';
		qtips['qtips.column.gas'] = '<fmt:message key="qtips.column.gas"/>';
		qtips['qtips.column.heating'] = '<fmt:message key="qtips.column.heating"/>';
		qtips['qtips.column.phone'] = '<fmt:message key="qtips.column.phone"/>';
		qtips['qtips.column.intercom'] = '<fmt:message key="qtips.column.intercom"/>';
		qtips['qtips.column.internet'] = '<fmt:message key="qtips.column.internet"/>';
		qtips['qtips.column.tv'] = '<fmt:message key="qtips.column.tv"/>';
		qtips['qtips.column.total'] = '<fmt:message key="qtips.column.total"/>';

		/*rent tab qtips*/
		qtips['qtips.column.rent.area'] = '<fmt:message key="qtips.column.rent.area"/>';
		qtips['qtips.column.rent.peopleamount'] = '<fmt:message key="qtips.column.rent.peopleamount"/>';
		
		/*electricity tab qtips*/
		qtips['qtips.column.tarif.undersumma'] = '<fmt:message key="qtips.column.tarif.undersumma"/>';
		qtips['qtips.column.tarif.oversumma'] = '<fmt:message key="qtips.column.tarif.oversumma"/>';
		qtips['qtips.column.tarif.bordervalue'] = '<fmt:message key="qtips.column.tarif.bordervalue"/>';
		qtips['qtips.column.electricity.date'] = '<fmt:message key="qtips.column.electricity.date"/>';
		qtips['qtips.column.electricity.currentvalue'] = '<fmt:message key="qtips.column.electricity.currentvalue"/>';
		qtips['qtips.column.electricity.previousvalue'] = '<fmt:message key="qtips.column.electricity.previousvalue"/>';

		/*heating tab qtips*/
		qtips['qtips.heating.tariff.area'] = '<fmt:message key="qtips.heating.tariff.area"/>';
		qtips['qtips.heating.tariff.onem2'] = '<fmt:message key="qtips.heating.tariff.onem2"/>';

		/*water tab qtips*/
		qtips['qtips.water.cold.delta'] = '<fmt:message key="qtips.water.cold.delta"/>';
		qtips['qtips.water.hot.delta'] = '<fmt:message key="qtips.water.hot.delta"/>';
		qtips['qtips.water.cold.summa'] = '<fmt:message key="qtips.water.cold.summa"/>';
		qtips['qtips.water.hot.summa'] = '<fmt:message key="qtips.water.hot.summa"/>';
		qtips['qtips.water.counter.cold.current'] = '<fmt:message key="qtips.water.counter.cold.current"/>';
		qtips['qtips.water.counter.cold.previous'] = '<fmt:message key="qtips.water.counter.cold.previous"/>';
		qtips['qtips.water.counter.cold.delta'] = '<fmt:message key="qtips.water.counter.cold.delta"/>';
		qtips['qtips.water.counter.hot.current'] = '<fmt:message key="qtips.water.counter.hot.current"/>';
		qtips['qtips.water.counter.hot.previous'] = '<fmt:message key="qtips.water.counter.hot.previous"/>';
		qtips['qtips.water.counter.hot.delta'] = '<fmt:message key="qtips.water.counter.hot.delta"/>';

		/*internet tab qtips*/
		qtips['qtips.column.internet.undersumma'] = '<fmt:message key="qtips.column.internet.undersumma"/>';
		qtips['qtips.column.internet.oversumma'] = '<fmt:message key="qtips.column.internet.oversumma"/>';
		qtips['qtips.column.internet.bordervalue'] = '<fmt:message key="qtips.column.internet.bordervalue"/>';
		qtips['qtips.column.internet.unlimit.summa'] = '<fmt:message key="qtips.column.internet.unlimit.summa"/>';
		qtips['qtips.column.internet.currentvalue'] = '<fmt:message key="qtips.column.internet.currentvalue"/>';
		qtips['qtips.column.internet.advanced.summa'] = '<fmt:message key="qtips.column.internet.advanced.summa"/>';
		
	</script>
	<div id="viewport_container"></div>	
</body>
</html>